package com.tchepannou.limbe;

import javax.mail.MessagingException;
import javax.servlet.ServletContext;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;


/**
 * Base interface of controller contexts
 *
 * @author herve
 */
public interface Context
{
    public String getBasePackage ();
        
    public List<Interceptor> getInterceptors ();
        
    public <T extends Service> T findService (Class<T> type);
    
    /**
     * Call this method to rollback the current transaction
     */
    public void setRollback (boolean rollback);

    /**
     * Returns <code>true</code> if the current transaction should be rolled-back
     * @return
     */
    public boolean isRollback ();
    
    
    public Util createUtil();

    public ServletContext getServletContext ();

    public void deliverEmail (String action, Serializable data) throws IOException, MessagingException;
}
